package com.safe.ly_safe.activity;

import android.os.Build;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.RequiresApi;
import androidx.appcompat.widget.AppCompatButton;

import com.safe.ly_safe.R;
import com.safe.ly_safe.base.BaseActivity;
import com.safe.ly_safe.control.view.MainView;
import com.safe.ly_safe.utils.StatusBarUtil;
import com.safe.ly_safe.utils.SwitchButton;

import butterknife.BindView;

/**
 * @PACKAGE :com.safe.ly_safe.activity
 * @Author : HSF
 * @Time : On 2022/4/25 15:23
 * @Description : ServerSetActivity
 * 登陆页--服务器列表--服务器设置
 */
public class ServerSetActivity extends BaseActivity implements MainView {

    @BindView(R.id.backIv)
    ImageView backIv;

    @BindView(R.id.titleTv)
    TextView titleTv;

    @BindView(R.id.saveBtn)
    AppCompatButton saveBtn;

    @BindView(R.id.mSwitchBtn)
    SwitchButton switchButton;

    @Override
    protected void setFullScreen() {

    }

    @Override
    protected int setContentViewId() {
        return R.layout.activity_server_set_layot;
    }

    @Override
    protected String loadingMsg() {
        return null;
    }

    @RequiresApi(api = Build.VERSION_CODES.M)
    @Override
    protected void initView() {
        StatusBarUtil.setStatusBarLightMode(getWindow()); //设置状态栏黑色字体图标
        titleTv.setText("服务器设置");
        backIv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        saveBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        switchButton.setChecked(false);
        //switchButton.isChecked();
        //switchButton.toggle();     //switch state
        //switchButton.toggle(false);//switch without animation
        switchButton.setShadowEffect(true);//disable shadow effect
        //switchButton.setEnabled(false);//disable button
        //switchButton.setEnableEffect(false);//disable the switch animation
        switchButton.setOnCheckedChangeListener(new SwitchButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(SwitchButton view, boolean isChecked) {
                //TODO do your job
                Log.i("ServerSetActivity","isChecked>>>>"+isChecked);
            }
        });
    }

    @Override
    public void showLoading(int type) {

    }

    @Override
    public void hideLoading(int type) {

    }

    @Override
    public void onSuccess(int type, Object result) {

    }

    @Override
    public void onError(int type, Throwable e) {

    }
}
